/* jsflow.css主要用于定义画布样式，和覆盖样式 */
$white: #ffffff;
$whiteDash: #fafafa;
$whiteDark: #ced1d6;
$greyDash: #b1b5bc;
$greyBorder: #a9adb5;
$greyDark: #878c9c;
$greyDisable: #cfcccc;
$greenDark: #30d878;
$redDark: #ff5757;
$yellowDark: #f8b53f;
$blueDefault: #348af3;
$blueDark: #53699d;

.bk-flow-wrap {
    display: block;
    &.is-edit {
        .node-circle, .node-with-text {
            &:hover {
                .common-icon-dark-circle-close {
                    display: inline-block;
                }
            }
        }
        .jtk-overlay.jtk-hover {
            display: inline-block;
        }
        .common-icon-dark-circle-close,
        .jtk-endpoint svg:hover {
            cursor: pointer;
        }
    }
}

.bk-flow-canvas {
    overflow: hidden !important;
    border: 0;
    .bk-flow-container {
        position: relative;
    }
    .jtk-overlay {
        .common-icon-dark-circle-close{
            font-size: 16px;
            color: $redDark;
            background: $white;
            border-radius: 50%;
        }
        
    }
    .tooltip {
        z-index: 4;
        &[x-placement^="top"] {
            padding-bottom: 5px;
            .tooltip-arrow {
                border-width: 5px 5px 0 5px;
                border-left-color: transparent;
                border-right-color: transparent;
                border-bottom-color: transparent;
                bottom: 0;
                left: calc(50% - 5px);
                margin-top: 0;
                margin-bottom: 0;
            }
        }
        &[x-placement^="bottom"] {
            padding-top: 5px;
            .tooltip-arrow {
                border-width: 0 5px 5px 5px;
                border-left-color: transparent;
                border-right-color: transparent;
                border-top-color: transparent;
                top: 0;
                left: calc(50% - 5px);
                margin-top: 0;
                margin-bottom: 0;
            }
        }
        .tooltip-arrow {
            position: absolute;
            margin: 5px;
            width: 0;
            height: 0;
            border-style: solid;
            border-color: #333333;
        }
        .tooltip-inner {
            color: #ffffff;
            border-radius: 4px;
            padding: 10px;
            text-align: center;
            background: #333333;
        }
        .tooltip-btn {
            display: inline-block;
            margin-right: 5px;
            font-size: 12px;
            cursor: pointer;
            &:hover {
                color: $blueDefault;
            }
            &:last-child {
                margin-right: 0;
            }
        }
    }
    // 节点选择框样式
    .select-wrapper {
        position: absolute;
        border: 1px solid #3c96ff;
        background: rgba(60, 150, 255, 0.1);
        z-index: 4;
        pointer-events: none;
    }
    // 被选中节点
    .bk-flow-location.selected {
        outline: 1px dashed #348af3;
    }
}

.bk-flow-location {
    position: absolute;
    z-index: 2;
    cursor: pointer;
    -webkit-transition: -webkit-box-shadow 0.15s ease-in;
    -moz-transition: -moz-box-shadow 0.15s ease-in;
    -o-transition: -o-box-shadow 0.15s ease-in;
    transition: box-shadow 0.15s ease-in;
    .node-circle {
        width: 60px;
        height: 60px;
        font-size: 30px;
        color: $blueDark;
        text-align: center;
        background: $whiteDash;
        border-radius: 50%;
        border: 1px dashed $greyDash;
        &:hover {
            color: $blueDefault;
            border-color: $blueDefault;
            box-shadow: -1px 1px 8px rgba(83, 105, 157, 0.15), 1px -1px 8px rgba(83, 105, 157, 0.15);
        }
        &.FINISHED {
            &:hover {
                box-shadow: -1px 1px 8px rgba(48, 216, 120, 0.15), 1px -1px 8px rgba(48, 216, 120, 0.15);
            }
            border-color: $greenDark;
            color: $greenDark;
        }
        &.FAILED {
            &:hover {
                box-shadow: -1px 1px 8px rgba(255, 87, 87, 0.15), 1px -1px 8px rgba(255, 87, 87, 0.15);
            }
            border-color: $redDark;
            color: $redDark;
        }
        .node-type-icon {
            margin-top: 14px;
        }
        .common-icon-dark-circle-close {
            top: -4px;
            right: -4px;
        }
    }
    .node-with-text {
        width: 152px;
        height: 90px;
        text-align: center;
        background: $white;
        user-select: none;
        &:hover {
            box-shadow: -1px 1px 8px rgba(83, 105, 157, 0.15), 1px -1px 8px rgba(83, 105, 157, 0.15);
            .node-name {
                border-color: $blueDark;
            }
        }
        &.FINISHED {
            &:hover {
                box-shadow: -1px 1px 8px rgba(48, 216, 120, 0.15), 1px -1px 8px rgba(48, 216, 120, 0.15);
            }
            .node-name, &.node-subflow {
                border-color: $greenDark;
            }
            .task-name, .subflow-node-icon {
                background: $greenDark;
            }
        }
        &.FAILED {
            &:hover {
                box-shadow: -1px 1px 8px rgba(255, 87, 87, 0.15), 1px -1px 8px rgba(255, 87, 87, 0.15);
            }
            .node-name, &.node-subflow {
                border-color: $redDark;
            }
            .task-name, .subflow-node-icon {
                background: $redDark;
            }
        }
        &.RUNNING {
            &:hover {
                box-shadow: -1px 1px 8px rgba(248, 181, 63, 0.15), 1px -1px 8px rgba(248, 181, 63, 0.15);
            }
            .node-name, &.node-subflow {
                border-color: $yellowDark;
            }
            .task-name, .subflow-node-icon {
                background: $yellowDark;
            }
        }
        &.SUSPENDED {
            &:hover {
                box-shadow: -1px 1px 8px rgba(83, 105, 157, 0.15), 1px -1px 8px rgba(83, 105, 157, 0.15);
            }
            .node-name, &.node-subflow {
                border-color: $yellowDark;
            }
            .task-name, .subflow-node-icon {
                background: $yellowDark;
            }
        }
        &.isActived {
            box-shadow: -1px 1px 8px rgba(60, 150, 255, 0.25), 1px -1px 8px rgba(60, 150, 255, 0.25);
            .node-name {
                border-color: #3c96ff;
            }
        }
        .node-name {
            display: table;
            width: 100%;
            font-size: 12px;
            height: 60px;
            background: $whiteDash;
            border: 1px solid $greyBorder;
            border-bottom: none;
            table-layout: fixed;
            overflow: hidden;
            .name {
                display: table-cell;
                padding: 0 10px;
                width: 100%;
                text-align: center;
                vertical-align: middle;
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
            }
        }
        .task-name {
            height: 30px;
            line-height: 30px;
            font-size: 14px;
            color: $white;
            background: $blueDark;
            border-top: none;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .common-icon-dark-circle-close {
            top: -12px;
            right: -10px;
        }
        .running-state {
            position: absolute;
            top: -10px;
            right: -8px;
            width: 18px;
            height: 18px;
            line-height: 18px;
            font-size: 14px;
            color: $white;
            background: $yellowDark;
            text-align: center;
            border-radius: 50%;
            .common-icon-clock {
                display: inline-block;
                margin-top: 2px;
            }
            .common-icon-double-vertical-line {
                display: inline-block;
                color: $white;
                font-size: 12px;
                transform: scale(0.8);
            }
            .common-icon-loading {
                display: inline-block;
                vertical-align: -1px;
                animation: bk-button-loading 1.4s infinite linear;
            }
            @keyframes bk-button-loading {
                from {
                  -webkit-transform: rotate(0);
                  transform: rotate(0); }
                to {
                  -webkit-transform: rotate(360deg);
                  transform: rotate(360deg); } 
            }
        }
        .task-operation {
            position: absolute;
            left: -18px;
            top: -8px;
            width: 14px;
        }
        .task-optional {
            width: 14px;
            height: 14px;
            line-height: 14px;
            font-size: 12px;
            color: $white;
            text-align: center;
            border-radius: 100%;
            background: $blueDefault;
            &::after {
                content: "";
                position: absolute;
                left: 2px;
                top: 3px;
                height: 4px;
                width: 8px;
                border-left: 1px solid;
                border-bottom: 1px solid;
                border-color: $white;
                transform: rotate(-45deg);
            }
        }
        .dark-circle {
            margin-top: 2px;
            font-size: 14px;
            color: $blueDefault;
            text-align: center;
        }
        .node-checkbox {
            input[type="checkbox"] {
                display: none;
            }
            label {
                position: relative;
                display: inline-block;
                width: 14px;
                height: 14px;
                border: 1px solid $greyBorder;
                cursor: pointer;
                &.label-disabled {
                    cursor: not-allowed;
                }
            }
            input[type="checkbox"]:checked + label {
                background: $blueDefault;
                border-color: $blueDefault;
                &::after {
                    content: "";
                    position: absolute;
                    left: 1px;
                    top: 2px;
                    height: 4px;
                    width: 8px;
                    border-left: 2px solid;
                    border-bottom: 2px solid;
                    border-color: $white;
                    transform: rotate(-45deg);
                    
                }
            }
        }
        .task-skipped-icon {
            font-size: 14px;
            color: $blueDefault;
        }
    }
    
    .node-circle, .node-with-text {
        position: relative;
        .common-icon-dark-circle-close {
            display: none;
            position: absolute;
            font-size: 16px;
            color: $redDark;
            background: $white;
            border-radius: 50%;
            z-index: 2;
        }
        .updated-dot {
            position: absolute;
            top: -10px;
            right: -8px;
            display: inline-block;
            width: 10px;
            height: 10px;
            background: $redDark;
            border-radius: 50%;
            z-index: 1;
        }
    }
    .node-subflow {
        border-top: 5px solid $blueDark;
        .node-name {
            padding-top: 7px;
            height: 55px;
        }
        .subflow-node-icon {
            position: absolute;
            top: -2px;
            left: 0;
            width: 24px;
            height: 19px;
            line-height: 19px;
            font-size: 18px;
            color: $white;
            background: $blueDark;
        }
    }
}

.jtk-overlay {
    cursor: pointer;
    &:not(.branch-condition) {
        display: none;
    }
}

.branch-condition {
    padding: 4px 10px;
    min-width: 60px;
    max-width: 200px;
    font-size: 12px;
    text-align: center;
    background: #e1f3ff;
    border: 1px solid #c3cdd7;
    border-radius: 2px;
    z-index: 3;
    cursor: pointer;
}
.startpoint-node, .endpoint-node {
    .node-type-status {
        display: flex;
        width: 50px;
        height: 50px;
        margin: 4px 10px 0px 4px;
        background: #53699d;
        justify-content: center;
        align-items: center;
        border-radius: 25px;
        -moz-border-radius: 25px;
        -webkit-border-radius: 25px;
        &.FINISHED {
            background: $greenDark;
        }
        .startpoint-span,
         .endpoint-span{
            color: #ffffff;
            font-size: 12px;
        }
    }
}